//
//  BaseRequestModel.h
//  PiaoYoung
//
//  Created by LiTengFei on 15/1/12.
//  Copyright (c) 2015年 HangZhou PiaoYoung Co.Ltd. All rights reserved.
//

#import "PYResult.h"
#import "PYError.h"
#import "AFNetworking.h"
#import "AFHTTPRequestOperation.h"

typedef NSInteger CodeStateStyle;

static CodeStateStyle CodeStateStyleSuccess = 1;
static CodeStateStyle CodeStateStyleFail = -1;
static CodeStateStyle CodeStateStyleTokenInvalid = -100;

@interface RequestOperationManager : AFHTTPRequestOperationManager

extern NSDictionary *transfer(NSDictionary *originDictionary);

+(void)setVersionEnable:(BOOL)enableVersion;
+ (void)startWithBaseURL:(NSString *)baseURL;

+ (instancetype)defaultManager;

- (AFHTTPRequestOperation *)get:(NSString *)url
                         params:(NSDictionary *)params
                       complete:(void (^)(PYResult *result))complete
                          error:(void (^)(PYError *error))error
                     analyBlock:(AnalyseBlock)analyse;

- (AFHTTPRequestOperation *)post:(NSString *)url
                          params:(NSDictionary *)params
                        complete:(void (^)(PYResult *result))complete
                           error:(void (^)(PYError *error))error
                      analyBlock:(AnalyseBlock)analyse;



+ (AFHTTPRequestOperation *)get:(NSString *)url params:(NSDictionary *)params complete:(void (^)(PYResult *result))complete error:(void (^)(PYError *error))error analyBlock:(AnalyseBlock)analyse __deprecated;

+ (AFHTTPRequestOperation *)post:(NSString *)url params:(NSDictionary *)params complete:(void (^)(PYResult *result))complete error:(void (^)(PYError *error))error analyBlock:(AnalyseBlock)analyse __deprecated;

NSDictionary *lowperCaseWithDictionary(NSDictionary *dictionary);

@end

